﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XMLToCS
{
    // <summary>
    /// 特性：特性是一个直接/间接继承自attribute的类
    ///       约定俗成用attribute结尾，然后声明的时候可以省略
    /// </summary>
    //[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
    public class CustomAttribute : Attribute
    {
        public CustomAttribute()
        {
            Console.WriteLine("这里是CustomAttribute");
        }
        public CustomAttribute(string remark)
        {
            Console.WriteLine("这里是CustomAttribute带参数");
        }

        public string Remark { get; set; }

        public string Description { get; set; }

        public void Show()
        {
            Console.WriteLine($"This is {this.GetType().Name}");
        }

    }


    public class CustomChildAttribut : CustomAttribute
    {
    }

    public class AuthorityAttribute : Attribute
    {

        public string Remark { get; set; }

        public bool IsLogin()
        {
            return new Random().Next(100, 200) > new Random().Next(99, 199);
        }
    }

   
    public class MyExtendAttribute : System.Attribute
    {
        public MyExtendAttribute(string name)
        {
            Remark = name;
        }

        public string Remark { get; set; }


    }
}
